<?php

namespace app\common\model\xiluedu;

use think\Model;
use function fast\array_get;

class UserMessage extends Model
{

    const TYPE_COURSE_ORDER = 1; //线上课程购买
    const TYPE_OFFLINE_ORDER = 2; //线下课程购买
    const TYPE_VIP_ORDER = 3; //购买vip

    protected $name = 'xiluedu_user_message';

    protected $autoWriteTimestamp = 'int';
    protected $dateFormat = 'Y-m-d H:i:s';

    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    public function setExtraAttr($value, $data) {
        return is_string($value) ? $value : json_encode($value, JSON_UNESCAPED_UNICODE);
    }

    public function getExtraAttr($value, $data) {
        $value = $value ? : array_get($data, 'extra');
        return is_string($value) ? json_decode($value,true) : $value;
    }


}
